package com.joinlabs.action;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;

import com.joinlabs.entity.Weibo;
import com.joinlabs.service.IWeiboServiceZ;
import java.util.List;

@Controller
@RequestMapping("/homepage")
@SessionAttributes(names= {"weibodb"})
public class HomePage {
	//访问微博首页界面
	
	@Resource
	private IWeiboServiceZ weiboserviceZ;
	
	@RequestMapping("/homepage")
	public ModelAndView index(ModelMap map){
		
       List<Weibo> lw = weiboserviceZ.selectWeiboByType();
       
//       System.out.println(lw);
		
		map.addAttribute("weibodb", lw);
		
		return new ModelAndView("/homepage/homepage");
	}
}
